﻿#include <iostream>
class Xobject {
public:
    char Name[0x20];
private:
    int l;
};
class object {
public:
    char Name[0x20];
    int getMapId() { return mapId; }
    void setMapId(int val) { mapId = val; }
private:
    int mapId;
};
class mapObject:protected object {//继承object
public:
    int x;
    int y;
    mapObject() {
       
    }
protected://外界用不了，只能让继承类使用
    int t;
    int getHP(int x2) {
        x = 2;
    }
private://外界与继承类都使用不了
    int a;
};
class MoveObject : public mapObject {//继承mapObject
public:
    int hp;
    int lv;
    
    Xobject X;//包含关系

    using mapObject::t;//将继承的protected属性变为public
    using mapObject::getHP;//修改函数属性不需要后面的参数

    MoveObject() {  
        t = 100;//访问父类的protected属性变量
        x = 100;
        y = 100;
    }
};
int main()
{
    MoveObject npc;
    npc.t;
    std::cout << sizeof(object) << std::endl;//32
    std::cout << sizeof(mapObject) << std::endl;//40
    std::cout << sizeof(MoveObject) << std::endl;//48


}
